<link rel="stylesheet" href="__PUBLIC__/admin/css/bootstrap.css">
<div class="content"> 
                <div class="operation">
                    <div class="pull-left">
                        
                            <button type="submit" class="add"><span class="glyphicon glyphicon-plus"></span>提交订单</button>
                        
                    </div>
                    <div class="right-box">
                        <input type="search" placeholder="搜索..." name="search" class="search" value="{$search}">
                        <span class="glyphicon glyphicon-search" id="sub"></span>
                    </div>
                </div>
                <table class="table">
                    <tbody>
                    <tr>
                        <th><input type="checkbox"/ id="all" name="all"></th>
                        <volist name="header" id="vo">
                            <th>{$vo}
                                <span>
                                    <a class="glyphicon glyphicon-triangle-top"></a>
                                    <a class="glyphicon glyphicon-triangle-bottom"></a>
                                </span>
                            </th>
                        </volist>
                    </tr>
                        <volist name="list" id="vo">
                        <tr>
                            <td><input type="checkbox"/ name="box" class="{$vo['id']}"></td>
                            <volist name="vo" id="v">
                                <td>{$v}</td>
                            </volist>
                        </tr>
                        </volist>       
                </tbody>
            </table>
                <div class="page">
                    <span>共 {$count} 条</span>
                    <div class="paging">
                        {$page}
                    </div>
                    前往<input type="text" value="{$p}" name='page' onchange="mychange()">页
                </div>    
            </div>

            <div class="modal fade bs-example-modal-lg">
            <div class="modal-dialog modal-lg">
                <div class="modal-content" style="padding: 30px 0 76px 30px">
                    <form action="{:U('Admin/Keywords/addSite')}" method="post" name="addSite">
                        
                    <input type="hidden" value="{$query_id}" name="query_id">
                    <input type="hidden" value="" name="keyList">
                    <div class="platform">
                        <h3>请选择需要优化的搜索平台</h3>
                        <div>
                            <p>pc端&nbsp;&nbsp;&nbsp; <input type="checkbox" name="seo[]" value="1" checked  />百度<input type="checkbox" name="seo[]" value="3" checked />360 <input type="checkbox" name="seo[]" value="5" checked />搜狗 </p>
                            <p>移动端 <input type="checkbox" name="seo[]" value="2" checked />百度<input type="checkbox" name="seo[]" value="4" checked />360 <input type="checkbox" name="seo[]" value="6" checked />搜狗 </p>
                        </div>
                    </div>
                    <div class="add-information">
                        <h3>添加你要优化的站点及FTP信息<span>(添加FTP信息将更有利于网站优化)</span></h3>
                        <div class="add-information-list">
                            <div>
                                <label>站点</label>
                                <input type="text" placeholder="www.baidu.com" name="site">
                            </div>
                            <div>
                                <label>FTP IP</label>
                                <input type="text" placeholder="请输入FTP IP" name="ftp_ip">
                            </div>
                            <div>
                                <label>FTP用户名</label>
                                <input type="text" placeholder="请输入FTP用户名" name="username">
                            </div>
                            <div>
                                <label>FTP 密码</label>
                                <input type="text" placeholder="请输入FTP密码" name="password">
                            </div>
                            <div>
                                <label>网站后台地址</label>
                                <input type="text" placeholder="请输入网站后台地址" style="width:205px;" name="adminadd">
                            </div>
                            <div>
                                <label>后台用户名</label>
                                <input type="text" placeholder="请输入网站后台用户名" style="width:205px;" name="adminusername">
                            </div>
                            <div>
                                <label>后台密码</label>
                                <input type="text" placeholder="请输入网站后台密码" style="width:205px;" name="adminpassword">
                            </div>
                        </div>
                    </div>
                    <div class="select-customers" style="margin-top:200px">
                        <h3>选择客户</h3>
                        <select name="user_id">
                            <volist name="users" id="v">
                                <option value="{$v['user_id']}">{$v['user_name']}</option>
                            </volist>
                        </select>
                    </div>
                    <div class="submit">
                        <button type="submit">提交</button>
                        <button type="reset">取消</button>
                    </div>
                   
                   </form>
                </div>
            </div>
        </div>
<script type="text/javascript">
    $("#sub").click(function(){
        var search = $('.search').val();
        window.location.href = "/Admin/Keywords/index.html?search="+search;
    });

    function mychange(){
      var page =  $('input[name="page"]').val();
      window.location.href = "/index.php/Admin/Keywords/index/p/"+page;
    }

    document.onclick = function(e) {
        var modal = 　$('.modal').css('display');
        // console.log(modal);
        if(modal == 'block'){
            $('.modal').css('display','none');
            $(".modal").removeClass("show");
            $("body").removeClass("modal-open");
            $("body").css("padding-right",'0');
            $(".modal-backdrop").remove();
        }　　　　　
    }


    $(".add").click(function(){
        var chk_value = '';
        var checked = $('input[name=box]')
        for(var i = 0; i <checked.length; i ++){
            if(checked[i].checked){
                // chk_value.push(checked[i].classList[0]);
                chk_value += checked[i].classList[0]+',';
            }
        }
        // var wid = JSON.stringify(chk_value);
        var wid = chk_value.substring(0,chk_value.length-1);
        var t = chk_value.length;
        if(t < 1){
            alert('请选择需要优化的关键词');
            return;
        }
        $("input[name='keyList']").val(wid);




        $("body").addClass("modal-open");
        $(".modal").addClass("show");
        $('.modal').css('display','block');
        $('input[name="act"]').val('edit');
        $("body").append("<div class='modal-backdrop fade show'></div>");

    });
    
    $(".modal-content").click(function(event){
        event.stopPropagation();
    });

    $(".add").click(function(event){
        event.stopPropagation();
    });

    $("#all").click(function(){
        // this 全选的复选框
        var userids=this.checked;
        //获取name=box的复选框 遍历输出复选框
        $("input[name=box]").each(function(){
            this.checked=userids;
        });
    });

</script>